
double BiRoot(double (*fun)(double), double a, double b)
{

	double mid;
	mid=(a+b)/2.0;
	if(fun(a)*fun(b)<0)
	{
		if(fabs(fun(mid))<1.0E-6)
		{
			return mid;
		}
		else if(fun(a)*fun(mid)<0)
		{
			
			return BiRoot(fun,a,mid);
		}
		else if(fun(mid)*fun(b)<0)
		{
			
			return BiRoot(fun,b,mid);
		}

	}
	
}
